import 'package:casdon/core/logger/log.dart';
import 'package:casdon/core/network/business_exception.dart';
import 'package:casdon/modules/lifeCircle/data/repository/life_repository.dart';

class LifeCommentReplyUsecase {
  final LifeRepository _repository;

  const LifeCommentReplyUsecase(this._repository);

  Future<List<Map<String, dynamic>>> execute({
    required String commentId,
    required int pageNum,
    required int pageSize,
  }) async {
    try {
      final ret = await _repository.getCommentReply(
        commentId: commentId,
        pageNum: pageNum,
        pageSize: pageSize,
      );
      return ret ?? const [];
    } on BusinessException {
      rethrow;
    } catch (e, st) {
      Log.e('LifeCommentReplyUsecase 失败', e.toString(), st);
      throw Exception('获取评论回复失败');
    }
  }
}

